package com.tt.qiyuesuo.utils;

public class Response<T>{

    private Boolean success;

    private T data;



    public static <T> Response<T> successResponse() {


        Response<T> response = new Response();
        response.setSuccess(true);
        response.setData(null);
        return response;
    }

    public static <T> Response<T> successResponse(T data) {
        Response<T> response = new Response();
        response.setSuccess(true);
        response.setData(data);
        return response;
    }

    public static <T> Response<T> failedResponse() {

        Response<T> response = new Response();
        response.setSuccess(false);
        response.setData(null);
        return response;
    }

    public static <T> Response<T> failedResponse(T data) {
        Response<T> response = new Response();
        response.setSuccess(false);
        response.setData(data);
        return response;
    }


    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return "Response{" +
                "success=" + success +
                ", data='" + data + '\'' +
                '}';
    }
}